package com.hotchpotch.util;

import android.app.ProgressDialog;
import android.content.Context;

public class ProgressDialogLoadingUtil {
    private static ProgressDialog progressDialog;

    /**
     * 显示加载框
     * @param context
     * @param hint
     */
    public static void showProgressDialog(Context context, String hint) {
        if (progressDialog == null) {
            Logg.e("显示加载框", "创建");
            progressDialog = new ProgressDialog(context);
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.setMessage(hint);
            progressDialog.setCancelable(false);
            progressDialog.show();
        }
    }

    /**
     * 取消加载框
     */
    public static void cancelProgressDialog() {
        if (progressDialog != null) {
            if (progressDialog.isShowing()) {
                progressDialog.dismiss();
            }
        }
    }
}
